package testcase;

import junit.framework.TestCase;
import player.Player;
import game.LandlordElection;

public class LandlordElectionTest extends TestCase {
	
	class PlayerStub extends Player{

		private int rating;
		
		public PlayerStub(String n, int id, int rating) {
			super(n, id, null);
			this.rating = rating;
		}
		
		public int landLordRating()
		{				
			return rating;
		}
		
		
		
		
	}
	
	public void testElectFirstPlayer()
	{
		Player[] players = new Player[3];
		players[0] = new PlayerStub("A",0,3);
		players[1] = new PlayerStub("B",1,1);
		players[2] = new PlayerStub("C",2,1);
		
		LandlordElection election = new LandlordElection(players,null);
		Player landlord = election.elect();
			
		assertEquals(players[0],landlord);			
	}
	
	public void testElectThirdPlayer()
	{
		Player[] players = new Player[3];
		players[0] = new PlayerStub("A",0,1);
		players[1] = new PlayerStub("B",1,2);
		players[2] = new PlayerStub("C",2,3);
		
		LandlordElection election = new LandlordElection(players,null);
		Player landlord = election.elect();
			
		assertEquals(players[2],landlord);		
	}
	
	public void testElectSecondPlayer()
	{
		Player[] players = new Player[3];
		players[0] = new PlayerStub("A",0,1);
		players[1] = new PlayerStub("B",1,3);
		players[2] = new PlayerStub("C",2,3);
		
		LandlordElection election = new LandlordElection(players,null);
		Player landlord = election.elect();
			
		assertEquals(players[1],landlord);		
	}
	
	
	

}
